package com.cws.backup.factory;

import com.cws.backup.entity.BackupEntity;
import com.cws.backup.factory.impl.MysqlBackupHandler;
import com.cws.backup.factory.impl.OracleBackupHandler;

import java.util.Objects;

public class BackUpHandlerFactory {
    public static BackupHandler getBackUpHandler(BackupEntity backupEntity) {
        String type = backupEntity.getType();
        if (Objects.equals(type, "MySQL")) return new MysqlBackupHandler();
        if (Objects.equals(type, "Oracle")) return new OracleBackupHandler();
        throw new RuntimeException("不支持的数据库类型!");
    }
}
